package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.CourseTeacherDto;
import com.xuecheng.content.model.dto.CourseTeacherModifyDto;
import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 陈竞超
 * @version 1.0
 * @qq 2250537249
 */
@Api(value = "教师信息编辑接口",tags = "教师信息编辑接口")
@RestController
public class CourseTeacherController {
    @Autowired
    CourseTeacherService courseTeacherService;
    @ApiOperation("查询教师")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> queryTeacher(@PathVariable Long courseId){
        return courseTeacherService.queryTeacherInfo(courseId);
    }
    @ApiOperation("添加教师")
    @PostMapping("/courseTeacher")
    public CourseTeacher addTeacher(@RequestBody CourseTeacherDto courseTeacherDto){
        return courseTeacherService.AddTeacherInfo(courseTeacherDto);
    }
    @ApiOperation("修改教师")
    @PutMapping("/courseTeacher/modify")
    public void modifyTeacher(@RequestBody CourseTeacherModifyDto courseTeacherModifyDto){
        courseTeacherService.ModifyTeacher(courseTeacherModifyDto);
    }
    @ApiOperation("删除教师")
    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public void deleteTeacher(@PathVariable @Validated Long courseId,@PathVariable @Validated Long teacherId){
        courseTeacherService.DeleteTeacher(courseId,teacherId);
    }
}
